<?php
class Prueba extends Controller {
	function Prueba() {
		parent::Controller ();
		$this->output->enable_profiler ( TRUE );
	}
	
	function index() {
		$this->load->model("Node_Model", "Nodes");
		$el = $this->Nodes->get(array(
			"order"	=> array("hit.day" => "DESC")
		));
		
		$nodes_process = array();
		
		foreach($el as $node){
			$node->categories = $this->mp_cache->model("Nodes", "getCategories", array($node->id));
			$metas = $this->mp_cache->model("Nodes", "getMeta", array($node->id));
			$node->metas = $metas;
			$hits = $this->Nodes->getHit($node->id);
			$node->hits = $hits;
			
			array_push($nodes_process, $node);
		}
		
		echo "<pre>";
		print_r($nodes_process);
		echo "</pre>";
	}
	
	function index2() {
		$data = $this->mp_cache->set_name('prueba')->get();
		if ($data === FALSE){
			$data = "guardando en cache";
			$this->mp_cache->set_contents($data)->write();
		} else{
			echo "En cache";
		}
		
		echo "<br/>Data: $data";
	}
	
	function index3() {
		
		if(FALSE !== NULL){
			echo "FALSE != NULL";
		} else{
			echo "FALSE == NULL";
		}
	}
	
	function zend(){
		$this->load->library('zend');
		$this->zend->load('Zend/Gdata/YouTube');
		
		$yt = new Zend_Gdata_YouTube();
		$query = $yt->newVideoQuery();
		$query->setTime('today');
		$videoFeed = $yt->getTopRatedVideoFeed($query);
		
		foreach ($videoFeed as $videoEntry){
			
		}
	}
	
	function categories(){
		$this->load->model("category");
		$categorias = $this->category->getDescendantTreeById();
		
		print_r($categorias);
	}
}
?>